<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>图书馆管理系统 - 添加图书</title>
    <style>
        body { 
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
        }
        .container {
            display: flex;
            min-height: 100vh;
        }
        .sidebar { 
            width: 200px;
            background-color: #f8f9fa;
            padding: 20px;
        }
        .content { 
            flex: 1;
            padding: 20px;
        }
        .menu { 
            list-style-type: none;
            padding: 0;
            margin: 0;
        }
        .menu li { 
            margin-bottom: 10px;
        }
        .menu li a { 
            display: block;
            padding: 10px;
            background-color: #e9ecef;
            text-decoration: none;
            color: #495057;
            border-radius: 4px;
        }
        .menu li a:hover { 
            background-color: #dee2e6;
        }
        .error { 
            color: red;
            margin-top: 10px;
        }
        form div {
            margin-bottom: 15px;
        }
        label {
            display: inline-block;
            width: 120px;
            font-weight: bold;
        }
        input[type="text"],
        input[type="date"],
        select {
            padding: 8px;
            width: 300px;
            border: 1px solid #ced4da;
            border-radius: 4px;
        }
        button {
            padding: 10px 20px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        button:hover {
            background-color: #0069d9;
        }
    </style>
</head>
<body>
    <h1>图书馆管理系统 - 添加图书</h1>
    <div class="container">
        <div class="sidebar">
            <ul class="menu">
                <li><a href="dashboard.jsp">首页</a></li>
                <li><a href="${pageContext.request.contextPath}/book?action=list">图书管理</a></li>
                <li><a href="addBook.jsp">添加图书</a></li>
                <li><a href="${pageContext.request.contextPath}/user?action=list">用户管理</a></li>
                <li><a href="${pageContext.request.contextPath}/borrow?action=list">借阅记录</a></li>
                <li><a href="${pageContext.request.contextPath}/logout">退出登录</a></li>
            </ul>
        </div>
        <div class="content">
            <h2>添加图书</h2>
            <form action="${pageContext.request.contextPath}/book" method="post">
                <input type="hidden" name="action" value="add">
                <div>
                    <label for="title">书名:</label>
                    <input type="text" id="title" name="title" required>
                </div>
                <div>
                    <label for="author">作者:</label>
                    <input type="text" id="author" name="author" required>
                </div>
                <div>
                    <label for="isbn">ISBN:</label>
                    <input type="text" id="isbn" name="isbn" required>
                </div>
                <div>
                    <label for="publishDate">出版日期:</label>
                    <input type="date" id="publishDate" name="publishDate" required>
                </div>
                <div>
                    <label for="category">分类:</label>
                    <input type="text" id="category" name="category" required>
                </div>
                <div>
                    <button type="submit">添加</button>
                </div>
            </form>
            <c:if test="${not empty error}">
                <p class="error">${error}</p>
            </c:if>
        </div>
    </div>
</body>
</html>  